From 324df1cf568a8c12e5935b4f12bcc3f6c6ac4730 Mon Sep 17 00:00:00 2001 From: "smh22@firebug.cl.cam.ac.uk" Date: Tue, 26 Apr 2005 14:30:28 +0000 Subject: [PATCH] bitkeeper revision 1.1385.1.1 (426e50841dwkW8TPBgE1y4h3O71bsQ) build when DEBUG=1 + whitespace fixes --- BitKeeper/etc/ignore | 3 ++ tools/libxc/xc_linux_restore.c | 11 ++--- tools/libxc/xc_linux_save.c | 79 +++++++++++++++++++++------------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 3f65adddad..a5a240ec0b 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -140,3 +140,6 @@ xen/tools/figlet/figlet xen/xen xen/xen-syms xen/xen.* +linux-2.6.11-xen-sparse/include/asm-xen/multicall.h +tools/libxc/xc_linux_restore.c.SMH +tools/libxc/xc_linux_save.c.SMH diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 79f0c6ac45..30b6280414 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -170,13 +170,13 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024), -1, 1, &dom) ) { - xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB", - nr_pfns,nr_pfns * (PAGE_SIZE / 1024)); + xcio_error(ioctxt, "Could not create domain. pfns=%ld, %ldKB", + nr_pfns, nr_pfns * (PAGE_SIZE / 1024)); goto out; } ioctxt->domain = dom; - xcio_info(ioctxt, "Created domain %ld\n",dom); + xcio_info(ioctxt, "Created domain %u\n", dom); /* Get the domain's shared-info frame. */ op.cmd = DOM0_GETDOMAININFO; @@ -200,7 +200,8 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) } /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */ - if ( xc_get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns ) + if ( xc_get_pfn_list(xc_handle, dom, + pfn_to_mfn_table, nr_pfns) != nr_pfns ) { xcio_error(ioctxt, "Did not read correct number of frame " "numbers for new dom"); @@ -657,7 +658,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) if ( rc == 0 ) { /* Success: print the domain id. */ - xcio_info(ioctxt, "DOM=%lu\n", dom); + xcio_info(ioctxt, "DOM=%u\n", dom); return 0; } diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index fb30d2f7ad..8600e0fc59 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -167,7 +167,8 @@ static int burst_time_us = -1; #define RATE_TO_BTU 781250 #define BURST_TIME_US burst_time_us -static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n){ +static int xcio_ratewrite(XcIOContext *ioctxt, void *buf, int n) +{ static int budget = 0; static struct timeval last_put = { 0 }; struct timeval now; @@ -230,8 +231,8 @@ static int print_stats( int xc_handle, u32 domid, gettimeofday(&wall_now, NULL); - d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0, /* FIXME */ 0 )/1000; - d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid, /* FIXME */ 0 )/1000; + d0_cpu_now = xc_domain_get_cpu_usage(xc_handle, 0, /* FIXME */ 0)/1000; + d1_cpu_now = xc_domain_get_cpu_usage(xc_handle, domid, /* FIXME */ 0)/1000; if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) ) printf("ARRHHH!!\n"); @@ -273,10 +274,13 @@ static int print_stats( int xc_handle, u32 domid, * @param ioctxt i/o context * @return 0 on success, non-zero on error. */ -static int write_vmconfig(XcIOContext *ioctxt){ +static int write_vmconfig(XcIOContext *ioctxt) +{ int err = -1; - if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n))) goto exit; - if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n)) goto exit; + if(xcio_write(ioctxt, &ioctxt->vmconfig_n, sizeof(ioctxt->vmconfig_n))) + goto exit; + if(xcio_write(ioctxt, ioctxt->vmconfig, ioctxt->vmconfig_n)) + goto exit; err = 0; exit: return err; @@ -329,7 +333,8 @@ int suspend_and_state(int xc_handle, XcIOContext *ioctxt, retry: - if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, info, ctxt) ) + if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, + info, ctxt) ) { xcio_error(ioctxt, "Could not get full domain info"); return -1; @@ -347,7 +352,7 @@ retry: // try unpausing domain, wait, and retest xc_domain_unpause( xc_handle, ioctxt->domain ); - xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%lx)", + xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%u)", info->flags); usleep(10000); // 10ms @@ -357,14 +362,12 @@ retry: if( ++i < 100 ) { - xcio_error(ioctxt, "Retry suspend domain (%lx)", - info->flags); + xcio_error(ioctxt, "Retry suspend domain (%u)", info->flags); usleep(10000); // 10ms goto retry; } - xcio_error(ioctxt, "Unable to suspend domain. (%lx)", - info->flags); + xcio_error(ioctxt, "Unable to suspend domain. (%u)", info->flags); return -1; } @@ -442,7 +445,8 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) return 1; } - if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, &info, &ctxt) ) + if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, + &info, &ctxt) ) { xcio_error(ioctxt, "Could not get full domain info"); goto out; @@ -459,7 +463,9 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) /* cheesy sanity check */ if ( nr_pfns > 1024*1024 ){ - xcio_error(ioctxt, "Invalid state record -- pfn count out of range: %lu", nr_pfns); + xcio_error(ioctxt, + "Invalid state record -- pfn count out of range: %lu", + nr_pfns); goto out; } @@ -513,7 +519,8 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) for ( i = 0; i < nr_pfns; i += 1024 ){ if ( !translate_mfn_to_pfn(&pfn_to_mfn_frame_list[i/1024]) ){ - xcio_error(ioctxt, "Frame # in pfn-to-mfn frame list is not in pseudophys"); + xcio_error(ioctxt, + "Frame# in pfn-to-mfn frame list is not in pseudophys"); goto out; } } @@ -539,7 +546,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) ) { - xcio_error(ioctxt, "Domain appears not to have suspended: %lx", + xcio_error(ioctxt, "Domain appears not to have suspended: %u", info.flags); goto out; } @@ -836,7 +843,8 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) } /* end of page table rewrite for loop */ if ( xcio_ratewrite(ioctxt, page, PAGE_SIZE) ){ - xcio_error(ioctxt, "Error when writing to state file (4)"); + xcio_error(ioctxt, + "Error when writing to state file (4)"); goto out; } @@ -844,7 +852,8 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) if ( xcio_ratewrite(ioctxt, region_base + (PAGE_SIZE*j), PAGE_SIZE) ){ - xcio_error(ioctxt, "Error when writing to state file (5)"); + xcio_error(ioctxt, + "Error when writing to state file (5)"); goto out; } } @@ -903,14 +912,15 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) ) { - xcio_error(ioctxt, "Domain appears not to have suspended: %lx", + xcio_error(ioctxt, + "Domain appears not to have suspended: %u", info.flags); goto out; } xcio_info(ioctxt, - "SUSPEND flags %08lx shinfo %08lx eip %08lx " - "esi %08lx\n",info.flags, + "SUSPEND flags %08u shinfo %08lx eip %08u " + "esi %08u\n",info.flags, info.shared_info_frame, ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi ); } @@ -972,7 +982,8 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) { if ( xcio_write(ioctxt, &pfntab, sizeof(unsigned long)*j) ) { - xcio_error(ioctxt, "Error when writing to state file (6b)"); + xcio_error(ioctxt, + "Error when writing to state file (6b)"); goto out; } j = 0; @@ -1027,14 +1038,24 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) out: - if ( live_shinfo ) munmap(live_shinfo, PAGE_SIZE); - if ( p_srec ) munmap(p_srec, sizeof(*p_srec)); - if ( live_pfn_to_mfn_frame_list ) munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE); - if ( live_pfn_to_mfn_table ) munmap(live_pfn_to_mfn_table, nr_pfns*4 ); - if ( live_mfn_to_pfn_table ) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024 ); + if(live_shinfo) + munmap(live_shinfo, PAGE_SIZE); + + if(p_srec) + munmap(p_srec, sizeof(*p_srec)); + + if(live_pfn_to_mfn_frame_list) + munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE); + + if(live_pfn_to_mfn_table) + munmap(live_pfn_to_mfn_table, nr_pfns*4); + + if(live_mfn_to_pfn_table) + munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024); + + if (pfn_type != NULL) + free(pfn_type); - if ( pfn_type != NULL ) free(pfn_type); DPRINTF("Save exit rc=%d\n",rc); return !!rc; - } -- 2.30.2